package JawUpdateConfig;


use Initialize;

sub updateJawstatsConfig {
     my ( $bucketname) = @_;
my $config = Initialize::initialize( $bucketname);
my $data_file = '/var/www/jawstats/config.dist.php';
open( FH, "+<$data_file" ) or die "can't open $data_file $!";
@lines = <FH>;
foreach $file (@lines) {
     $file =~ s/site1/$bucketname/s;
     $file =~ s/\/path\/to\/data\//$config->{pawtconf}$bucketname\//s;
     $file =~ s/\/path\/to\/awstats.pl\//$config->{maindir}awstats.pl\//s;
     $file =~ s/http:\/\/www.my-1st-domain.com/$bucketname/s;
     $file =~ s/bucketname/$bucketname/s;
     
}
my $data_file1 = '/var/www/jawstats/config.php';
open( OUT, ">$data_file1" ) || die "cannot create $data_file1  $!";
foreach $file (@lines) { print OUT $file; }

}



1;

__END__
